const fs= require('fs');
var str='';
for (let i = 0; i < 500; i++) { 
    str+='我是测试数据132ABCacb\n'
}
var writeStream=fs.createWriteStream('./data/output.txt');

writeStream.write(str);

writeStream.end()//标记文件结尾, 想要触发on监听的finish,必须写. 不写也能完成写入,但是触发不了finish

writeStream.on('finish',()=>{
    console.log('写入完成')
})